home *** CD-ROM | disk | FTP | other *** search
/ The Business Master (3rd Edition) / The Business Master (3rd Edition).iso / files / comphelp / tutor31 / tutor31.txt
Encoding:
Text File  |  1985-11-20  |  11.9 KB  |  276 lines

  1.  
  2.  
  3.                         Using MS-DOS 3.1 on an IBM PC
  4.  
  5.                                       by
  6.  
  7.                                Mark S Cathcart
  8.  
  9.                                Systems Engineer
  10.                                 Chemical Bank
  11.                             200 Jericho Qaudrangle
  12.                               Jericho  NY  11753
  13.  
  14.                                AUGUST 26,1985.
  15.  
  16.     In an effort to organize my IBM PC XT/370 and its hard disks as well as
  17.     to ease the pains of chaNgi.g from version to version of MS-DOS I have
  18.     spent some time digging into MS-DOS and some of its standard features.
  19.  
  20.     What follows are a number of well known MS-DOS tips as well as some
  21.     undocumented features of some of the MS-DOS components and some uses
  22.     that may not have been thought of.  I am not trying to tell you how to
  23.     organize your PC but rather suggest a few things you might consider.
  24.  
  25.                       "TRUE REFINEMENT SEEKS SIMPLICITY"
  26.  
  27.     I will be discussing the following topics:
  28.             CONFIG.SYS - SHELL,LASTDRIVE
  29.             COMMAND.COM
  30.             PATHing
  31.             SUBST command
  32.             CHDIR command
  33.             The MS-DOS PROMPT
  34.             ANSI.SYS
  35.             BAT files
  36.             Environment Area
  37.  
  38.     CONFIG.SYS
  39.     ----------
  40.  
  41.     Two important parameters are found in this file (in terms of this
  42.     discussion !) they are SHELL= and LASTDRIVE= . I will discuss them in
  43.     reverse order.
  44.  
  45.         LASTDRIVE= was added in MS-DOS 3.1 as part of the PC Network
  46.                    support. You can specify the drive letter representing
  47.                    the last drive you wish to access. The importance of
  48.                    this parameter in this discussion is that it gives us
  49.                    the ability to access upto 21 logical disk drives via
  50.                    the SUBST command.
  51.  
  52.  
  53.         Format:    LASTDRIVE=n:
  54.  
  55.                           where n: is drive A:-Z:
  56.  
  57.         Remarks:   There seems to be no restriction on the coding of this
  58.                    parameter, you can specify Z: even if you have only one
  59.                    diskette drive.
  60.                    VM/PC users should be aware however that you should not
  61.                    go beyond the letter O: otherwise you will experience
  62.                    un-predictable results. This has been reported to IBM
  63.                    and has been closed as SUGGESTION for FUTURE
  64.                    IMPROVEMENT.
  65.  
  66.  
  67.         SHELL=     This parameter tell MS-DOS where to find COMMAND.COM .
  68.                    It is generally believed that this file has to reside in
  69.                    the root directory of the disk that is booted from, not
  70.                    so. There have also been a number of documents/programs
  71.                    showing methods of enlarging the MS-DOS environment
  72.                    area. At best some of these are risky, at worst they are
  73.                    down-right dangerous. You can via the SHELL= parameter
  74.                    change the size of the environment area as needed.
  75.  
  76.         Format:    SHELL=[n:][path]filename.ext [n:][path]  /D /P /F /E:nn
  77.  
  78.         Remarks:
  79.                    The first dive-path-filename.ext tells the system where
  80.                    to find the initial copy of COMMAND.COM to load.
  81.  
  82.                    The second drive-path tells the system where to find the
  83.                    COMMAND.COM to reload when required.
  84.  
  85.                    /D parameter tells MS-DOS not to executes the
  86.                    AUTOEXEC.BAT file at BOOT up time.
  87.  
  88.                    /P parameter tells MS-DOS to make the substitution
  89.                    permanent.
  90.  
  91.                    /F parameter tells MS-DOS to skip the response to the
  92.                    interrupt 24H handler message ABORT,RETRY or IGNORE .
  93.  
  94.                    /E parameter tells MS-DOS how many paragraphs to set
  95.                    aside for the environment area. This can be between 10
  96.                    and 62. The Default is /E:10
  97.  
  98.     With the addition of a carefully coded SHELL= statement in the
  99.     CONFIG.SYS file we can now put all files for a given version of MS-DOS
  100.     into a separate sub directory. This is with the exclusion of the IBM
  101.     BIOS/DOS files, which are created by the SYS command or FORMAT with
  102.     with /S parameter.
  103.  
  104.     Also now the drive that you are booting from does not have to contain
  105.     the COMMAND.COM file.
  106.  
  107.     So much for CONFIG.SYS, depending on your level of PC knowledge by now
  108.     you are either bored,confused or want to know more. Stick with me.
  109.  
  110.           "NO MAN IS USELESS, HE CAN ALWAYS SERVE AS A BAD EXAMPLE"
  111.  
  112.     A habit that almost all hard-disk drive users have is to keep their
  113.     files in sub-directories according to file type/use . This can be very
  114.     helpful when trying to locate a file (or program), keeping multiple
  115.     copies of files and even to some extent protecting files from prying
  116.     eyes.
  117.  
  118.     One difficult part of doing this is accessing these files easily and
  119.     being able to execute the programs without typing extensive and lengthy
  120.     path names. One way of executing the programs is to code the
  121.     sub-directory names in the PATH statement.
  122.  
  123.     There is (obviously ??) a problem with this though, you can only have
  124.     one PATH statement, that PATH statement can only be 127 characters in
  125.     length. I soon exceeded that.
  126.  
  127.     Assume for 1 minute that you have some directories named as follows:
  128.  
  129.     C:\DOS31
  130.     C:\PROGRAMS
  131.     C:\PROGRAMS\BAT-AIDS
  132.     C:\PROGRAMS\PASCAL
  133.     C:\PROGRAMS\PASCAL\SOURCE
  134.     C:\PROGRAMS\PASCAL\TUTOR
  135.     C:\PROGRAMS\NEWPROGS
  136.     C:\PROGRAMS\OLDPROGS
  137.     C:\PROGRAMS\PC-GAMES (yes, I do have a few.)
  138.     C:\COMMS
  139.     C:\COMMS\XTALK35
  140.     C:\COMMS\PC-TALK
  141.  
  142.     I have these and many others on the C: disk alone not to mention the D:
  143.     disk or any others I may be using. A quick glance should tell you that
  144.     you cannot possibly PATH to all these subdirectories, let alone any
  145.     more. Or can you ?
  146.  
  147.     As described above you can use the SHELL= parameter to specify upto 26
  148.     drive letters that need not all exist. When used with the SUBST command
  149.     this can be a powerful tool. Lets take a look at the SUBST command.
  150.  
  151.                    SUBST n: [n:][path]
  152.  
  153.                    n: is a drive that you dont really have hardware for.
  154.  
  155.                    [n:][path] is a disk subdirectory that will be searched
  156.                    when you specify n:
  157.  
  158.                    For example: In the above list of directories the
  159.                    C:\PROGRAMS directory is referenced a great deal, we
  160.                    could code that:
  161.  
  162.                    SUBST P: C:\PROGRAMS
  163.  
  164.                    If we then do a DIR P: all the files in that directory
  165.                    will be listed. Also the PATH command can now be coded
  166.                    as PATH=P:;P:\BAT-AIDS;P:\PASCAL............ etc.
  167.                    This avoids needless repetition and allows to a greater
  168.                    number of sub directories within the PATH command.
  169.  
  170.     With this method I PATH to 32 directories that all have meaningful
  171.     names.  And this leaves my root directory to be used for data files
  172.     only.
  173.  
  174.     This only presents one problem, getting to the subdirectories when you
  175.     want to access the files or do some kind of maintenance to them.  This
  176.     is acheived by the CHDIR command in MS-DOS.  To get to the subdirectory
  177.     that contains the source for my PASCAL programs I would enter
  178.     CHDIR C:\PROGRAMS\PASCAL\SOURCE which can be a pain if done often.
  179.  
  180.     PC Magazine Volume 4 Number 16 carried an article in its user-to-user
  181.     column describing BATMAKER.BAS a BASIC program that created bat files
  182.     with the name of the last subdirectory in a given path.
  183.  
  184.     From the above example C:\PROGRAMS\PASCAL\SOURCE could be goto by
  185.     typing SOURCE .  My implementation OF BATMAKER can be found on the
  186.     ISA-PC RBBS.  Mine differs from the one in PC-Magazine in two ways; one
  187.     it is executed from a BAT file that always issues "CHKDSK / V | FIND
  188.     "Dir" > TEMPFILE" and two all the BAT files are kept in another
  189.     subdirectory so that they can be erased before each run of BATMAKER.
  190.  
  191.  
  192.  
  193.  
  194.     If you are an MS-DOS expert by the time you reach this point you will
  195.     trying to decide if you should read any more or quit, to you I say
  196.  
  197.     "PATIENCE IS NOT PASSIVE, ON THE CONTRARY, IT IS CONCENTRATED STRENGTH"
  198.  
  199.     Another hassle when working with many subdirectories is knowing which
  200.     one you are in. The following example of the PROMPT command will solve
  201.     this for you and it will also show you how to set the SCREEN attributes
  202.     in a way that they will be reset following exit from a program (not
  203.     always the case in standard MS-DOS!!).
  204.  
  205.     PROMPT $e[1mReady$e[0m($e[7m$p$e[0m)$e[1m;$d / $t$h$h$h$e[0m$_
  206.            -----     ----- -----  ----- -----              -----
  207.     The $p will display the current directory
  208.     the $d causes the date to be shown
  209.     the $t causes the time to be shown
  210.  
  211.     Most of that should be old hat to you right ?? The rest of the
  212.     information not under-lined is makes the PROMPT a little prettier(?).
  213.     The data under-lined represents escape sequences used to set the color
  214.     and highlighting each time the PROMPT is displayed.
  215.  
  216.     I only have a Mono-chrome monitor and thus have not tested but believe
  217.     the following codes to be true:
  218.  
  219.       $e[0m = Normal    $e[1m = Highlight   $e[7m = Reverse video
  220.       $e[4m = Underline $e[5m = Blink       $e[8m = Dark(invisible)
  221.       $e[30m= Black     $e[31m= Red         $e[32m= Green
  222.       $e[33m= Yellow    $e[34m= Blue        $e[35m= Magenta
  223.       $e[36m= Cyan      $e[37m= White
  224.  
  225.     You will be able to do much more than this but its upto you to test
  226.     which you find best, the escape sequences are valid upto 49 I think.
  227.     Note that to make use of these escape sequences you must include
  228.     DRIVER=[n:][path]ANSI.SYS in the CONFIG.SYS file.
  229.  
  230.     And now before you go let me quickly talk about BAT files.
  231.  
  232.     BAT FILES
  233.     ----------
  234.  
  235.     These are a few simple tips on writing BAT files, the format and
  236.     operational characteristics of BAT commands changes from release to
  237.     release. Hopefully IBM will realize that this can be an important part
  238.     of MS-DOS and will stop mucking about with it, document it properly and
  239.     who knows, even develop it.
  240.  
  241.     Cause a blank line to be output enter "ECHO.  " note that there is a
  242.     period following ECHO, this will not be printed.
  243.  
  244.     Test for positive condition using IF subcommand when a replaceable
  245.     parameter %1 %2 %3 etc. may not have been supplied
  246.  
  247.     if $%1==$START  goto START
  248.  
  249.     this statement will execute correctly regardless if %1 has a value or
  250.     not.
  251.  
  252.     Setting and retrieving information via the MS-DOS environment area.
  253.     The environment area is where your PATH, PROMPT and COMSPEC values are
  254.     kept and retrieved by MS-DOS. You can make use of this area as well.
  255.  
  256.     To set issue   SET name=value
  257.     To retrieve    if $%name%==$YES echo YES
  258.  
  259.     Note that when you SET the value you DON NOT put it % signs but when
  260.     you want to test the value you must include the name in % signs.
  261.  
  262.     Unless you specifically reset the values they will last until you
  263.     re-boot or power off the PC. You should also be aware that you can run
  264.     out of space to set variables, this is especially true if you use any
  265.     memory resident MS-DOS programs such as SIDEKICK, DOSEDIT etc. To
  266.     create more space change or add the /E parameter to the SHELL=
  267.     statement in your CONFIG.SYS as detailed above.
  268.  
  269.     And finally, if you read all the way thru I hope you found this to be
  270.     of some use, remember:
  271.  
  272.       "There are few things more difficult than the art of making advice
  273.        agreeable."
  274.  
  275. 
  276.